import oracledb
# 启用 Thick 模式并指定客户端库路径
oracledb.init_oracle_client(lib_dir=r"D:\\soft\\oracle\\instantclient_12_1")
conn = oracledb.connect(user='SCOTT', password='Password', dsn='127.0.0.1:1521/orcl')
cursor = conn.cursor()
cursor.execute('SELECT * FROM EMP')
data = cursor.fetchone()
print(data)
cursor.close()
conn.close()